'use strict';

angular.module('order', ['ngRoute','ngAnimate'])

    .config(['$routeProvider', function($routeProvider) {
        $routeProvider.when('/order', {
            templateUrl: 'order/order.html',
            controller: 'orderCtrl'
        });
    }])

    .controller('orderCtrl', function($scope,$http,$routeParams,$log) {
        $scope.ordered=false;

        /*POST方式异步提交表单*/
        $scope.submitMyOrder=function(){
            var order={"did":$routeParams.did,"user_name":$scope.uname,"gender":$scope.gender,"phone":$scope.phone,"addr":$scope.addr};
            var str = jQuery.param(order);
            $http.post("app/data/dish_orderadd.php",str)
            .success(function(data){
                $scope.orderId=data.oid;
                $scope.ordered=true;
            });
        };

    });